
** Prep additional data seven cities **
clear
import delim "./input/NPIs_markel/sevencity_plusready.csv"

rename	totalnoofdaysofnonpharmaceutical 	days_npis
tempfile sevencities
save	"`sevencities'", replace

** Merge with patent data **
use		"./output/cities_clspatents_cats", clear

keep if !mi(extra_id)

merge m:1 extra_id using "`sevencities'", replace update
drop if _merge==2
drop	_merge

** Append to 43 Markel et al cities **
append using "./output/cities_patents_npis_cats"
drop stname ctname

** Make common id
gen		gen_idt = npi_id if mi(cls_id)
replace	gen_idt = 1000*(cls_id+1) if mi(npi_id)
egen gen_id = group(gen_idt)
drop	gen_idt

gen		in_Markel = (!mi(npi_id))

** Final cleaning

xtset  	gen_id f_myr
order 	gen_id city f_myr, first

compress

save 	"./output/cities_expandedpatents_cats", replace
clear
